package com.android.takagism.ui;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.Camera;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.android.takagism.R;
import com.android.takagism.utils.CameraUtils;

public class TestCameraActivity extends AppCompatActivity {

    Button open_flash_flash_btn;
    Button open_flash_btn;
    Button close_flash_flash_btn;
    Button close_flash_btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_camera);
        initView();
        bindView();
    }




    private void bindView() {
        OnClickListener onClickListener = new OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()){
                    case R.id.open_flash_btn:
                        CameraUtils.open();
                        break;
                    case R.id.open_flash_flash_btn:
                        CameraUtils.startFlash(300);
                        break;
                    case R.id.close_flash_btn:
                        CameraUtils.close();
                        break;
                    case R.id.close_flash_flash_btn:
                        CameraUtils.endFlash();
                        break;
                }
            }
        };
        open_flash_flash_btn.setOnClickListener(onClickListener);
        open_flash_btn.setOnClickListener(onClickListener);
        close_flash_flash_btn.setOnClickListener(onClickListener);
        close_flash_btn.setOnClickListener(onClickListener);
    }

    private void initView() {
        open_flash_flash_btn = findViewById(R.id.open_flash_flash_btn);
        open_flash_btn = findViewById(R.id.open_flash_btn);
        close_flash_flash_btn = findViewById(R.id.close_flash_flash_btn);
        close_flash_btn = findViewById(R.id.close_flash_btn);
    }
}